package com.github.thinwonton.spring.web.controller;

import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

public class LoginController extends AbstractController {

    protected ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request,
                                                 javax.servlet.http.HttpServletResponse response) throws Exception {
        String username = request.getParameter("username");
        String password = request.getParameter("password");

        ModelAndView mav = new ModelAndView("loginResult"); // 在/WEB-INF/jsp存在loginResult.jsp页面
        ModelMap modelMap = mav.getModelMap();
        modelMap.put("username", username);
        modelMap.put("password", password);
        modelMap.put("message", "登录成功");

        return mav;
    }
}
